package com.etc.pojo;

import java.util.Date;

import org.springframework.format.annotation.DateTimeFormat;

import com.etc.common.StringToDate;

public class Student {
    private Integer version;
    private String sname;
    private Integer id;
    private Date birthday;
    private String sex;
    public String getSname() {
        return sname;
    }
    public void setSname(String sname) {
        this.sname = sname;
    }
    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    
    @DateTimeFormat(pattern="yyyy-MM-dd")
    public Date getBirthday() {
        return birthday;
    }
    /**
     * 自己定义了一个getBirthdayStr
     * @return
     */
    public String getBirthdayStr() {
        System.out.println(this);
        if (birthday != null) 
            return StringToDate.SDF.format(birthday);
        else 
            return null;
    }
    
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    @Override
    public String toString() {
        return "Student [sname=" + sname + ", id=" + id + ", birthday=" + birthday + ", sex=" + sex
               + "]";
    }
    public Integer getVersion() {
        return version;
    }
    public void setVersion(Integer version) {
        this.version = version;
    }
}
